package com.androidx.p013lv.base.p014db;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import androidx.core.app.NotificationCompat;
import com.androidx.p013lv.base.bean.VideoHistory;
import com.androidx.p013lv.base.interfaces.Key;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import org.greenrobot.greendao.internal.DaoConfig;

/* renamed from: com.androidx.lv.base.db.VideoHistoryDao */
public class VideoHistoryDao extends AbstractDao<VideoHistory, Long> {
    public static final String TABLENAME = "VIDEO_HISTORY";

    /* renamed from: com.androidx.lv.base.db.VideoHistoryDao$Properties */
    public static class Properties {
        public static final Property CoverImg = new Property(5, String.class, "coverImg", false, "COVER_IMG");

        /* renamed from: Id */
        public static final Property f179Id = new Property(0, Long.class, TtmlNode.ATTR_ID, true, "_id");
        public static final Property PlayTime = new Property(4, Long.TYPE, "playTime", false, "PLAY_TIME");
        public static final Property Progress = new Property(6, Integer.TYPE, NotificationCompat.CATEGORY_PROGRESS, false, "PROGRESS");
        public static final Property Score = new Property(2, Double.TYPE, "score", false, "SCORE");
        public static final Property SelfMade = new Property(8, Boolean.TYPE, "selfMade", false, "SELF_MADE");
        public static final Property Title = new Property(3, String.class, Key.TITLE, false, "TITLE");
        public static final Property VideoId = new Property(1, Integer.TYPE, Key.VIDEO_ID, false, "VIDEO_ID");
        public static final Property VideoType = new Property(7, Integer.TYPE, "videoType", false, "VIDEO_TYPE");
    }

    /* access modifiers changed from: protected */
    @Override // org.greenrobot.greendao.AbstractDao
    public final boolean isEntityUpdateable() {
        return true;
    }

    public VideoHistoryDao(DaoConfig daoConfig) {
        super(daoConfig);
    }

    public VideoHistoryDao(DaoConfig daoConfig, DaoSession daoSession) {
        super(daoConfig, daoSession);
    }

    public static void createTable(Database database, boolean z) {
        String str = z ? "IF NOT EXISTS " : "";
        database.execSQL("CREATE TABLE " + str + "\"VIDEO_HISTORY\" (\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ,\"VIDEO_ID\" INTEGER NOT NULL ,\"SCORE\" REAL NOT NULL ,\"TITLE\" TEXT,\"PLAY_TIME\" INTEGER NOT NULL ,\"COVER_IMG\" TEXT,\"PROGRESS\" INTEGER NOT NULL ,\"VIDEO_TYPE\" INTEGER NOT NULL ,\"SELF_MADE\" INTEGER NOT NULL );");
    }

    public static void dropTable(Database database, boolean z) {
        StringBuilder sb = new StringBuilder();
        sb.append("DROP TABLE ");
        sb.append(z ? "IF EXISTS " : "");
        sb.append("\"VIDEO_HISTORY\"");
        database.execSQL(sb.toString());
    }

    /* access modifiers changed from: protected */
    public final void bindValues(DatabaseStatement databaseStatement, VideoHistory videoHistory) {
        databaseStatement.clearBindings();
        Long id = videoHistory.getId();
        if (id != null) {
            databaseStatement.bindLong(1, id.longValue());
        }
        databaseStatement.bindLong(2, (long) videoHistory.getVideoId());
        databaseStatement.bindDouble(3, videoHistory.getScore());
        String title = videoHistory.getTitle();
        if (title != null) {
            databaseStatement.bindString(4, title);
        }
        databaseStatement.bindLong(5, videoHistory.getPlayTime());
        String coverImg = videoHistory.getCoverImg();
        if (coverImg != null) {
            databaseStatement.bindString(6, coverImg);
        }
        databaseStatement.bindLong(7, (long) videoHistory.getProgress());
        databaseStatement.bindLong(8, (long) videoHistory.getVideoType());
        databaseStatement.bindLong(9, videoHistory.getSelfMade() ? 1 : 0);
    }

    /* access modifiers changed from: protected */
    public final void bindValues(SQLiteStatement sQLiteStatement, VideoHistory videoHistory) {
        sQLiteStatement.clearBindings();
        Long id = videoHistory.getId();
        if (id != null) {
            sQLiteStatement.bindLong(1, id.longValue());
        }
        sQLiteStatement.bindLong(2, (long) videoHistory.getVideoId());
        sQLiteStatement.bindDouble(3, videoHistory.getScore());
        String title = videoHistory.getTitle();
        if (title != null) {
            sQLiteStatement.bindString(4, title);
        }
        sQLiteStatement.bindLong(5, videoHistory.getPlayTime());
        String coverImg = videoHistory.getCoverImg();
        if (coverImg != null) {
            sQLiteStatement.bindString(6, coverImg);
        }
        sQLiteStatement.bindLong(7, (long) videoHistory.getProgress());
        sQLiteStatement.bindLong(8, (long) videoHistory.getVideoType());
        sQLiteStatement.bindLong(9, videoHistory.getSelfMade() ? 1 : 0);
    }

    @Override // org.greenrobot.greendao.AbstractDao
    public Long readKey(Cursor cursor, int i) {
        int i2 = i + 0;
        if (cursor.isNull(i2)) {
            return null;
        }
        return Long.valueOf(cursor.getLong(i2));
    }

    @Override // org.greenrobot.greendao.AbstractDao
    public VideoHistory readEntity(Cursor cursor, int i) {
        int i2 = i + 0;
        Long valueOf = cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2));
        int i3 = cursor.getInt(i + 1);
        double d = cursor.getDouble(i + 2);
        int i4 = i + 3;
        String string = cursor.isNull(i4) ? null : cursor.getString(i4);
        int i5 = i + 5;
        return new VideoHistory(valueOf, i3, d, string, cursor.getLong(i + 4), cursor.isNull(i5) ? null : cursor.getString(i5), cursor.getInt(i + 6), cursor.getInt(i + 7), cursor.getShort(i + 8) != 0);
    }

    public void readEntity(Cursor cursor, VideoHistory videoHistory, int i) {
        int i2 = i + 0;
        String str = null;
        videoHistory.setId(cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2)));
        videoHistory.setVideoId(cursor.getInt(i + 1));
        videoHistory.setScore(cursor.getDouble(i + 2));
        int i3 = i + 3;
        videoHistory.setTitle(cursor.isNull(i3) ? null : cursor.getString(i3));
        videoHistory.setPlayTime(cursor.getLong(i + 4));
        int i4 = i + 5;
        if (!cursor.isNull(i4)) {
            str = cursor.getString(i4);
        }
        videoHistory.setCoverImg(str);
        videoHistory.setProgress(cursor.getInt(i + 6));
        videoHistory.setVideoType(cursor.getInt(i + 7));
        videoHistory.setSelfMade(cursor.getShort(i + 8) != 0);
    }

    /* access modifiers changed from: protected */
    public final Long updateKeyAfterInsert(VideoHistory videoHistory, long j) {
        videoHistory.setId(Long.valueOf(j));
        return Long.valueOf(j);
    }

    public Long getKey(VideoHistory videoHistory) {
        if (videoHistory != null) {
            return videoHistory.getId();
        }
        return null;
    }

    public boolean hasKey(VideoHistory videoHistory) {
        return videoHistory.getId() != null;
    }
}
